package com.briup.mt.web.controller;

import com.briup.mt.bean.BaseUserRole;
import com.briup.mt.service.IBaseUserRoleService;
import com.briup.mt.utils.Message;
import com.briup.mt.utils.MessageUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.validation.constraints.NotNull;
import java.util.List;

@Validated
@RestController
@RequestMapping("/userRole")
public class BaseUserRoleController {
    @Autowired
    private IBaseUserRoleService userRoleService;
    @GetMapping("query")
    public Message query(Long id){
        List<BaseUserRole> list=userRoleService.query(id);
        return MessageUtil.success(list);
    }
    @GetMapping("findById")
    public com.briup.mt.utils.Message findById(long id) {
        return MessageUtil.success(userRoleService.findById(id));
    }
    @PostMapping("saveOrUpdate")
        public com.briup.mt.utils.Message saveOrUpdate(BaseUserRole userRole){
            return MessageUtil.success(userRoleService.saveOrUpdate(userRole));
        }
    @DeleteMapping("deleteById")
    public Message deleteById(Long id){
        userRoleService.deleteById(id);
        return MessageUtil.success("删除成功");
    }
}

